<extend name="Common@Layout:hui-admin" />
<block name="title"><title>管理员管理</title></block>
<block name="style">
</block>

<block name="main">
	<nav class="breadcrumb">
		<i class="Hui-iconfont"></i>
		 首页 <span class="c-gray en">&gt;</span>
		 管理员管理 <span class="c-gray en">&gt;</span>  
		管理员列表 
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
	</nav>
	
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray"> 
			<span class="l"> 
				<a href="javascript:;" class="btn btn-danger radius ajax-post confirm" target-form="mini-form" data-msg="确定批量删除？" data-url="/users/adminsadmin/del.html"><i class="Hui-iconfont"></i> 批量删除</a> 
				<a class="btn btn-primary radius" href="javascript:;" onclick="open_iframe_dialog('{:U('adminsadmin/edit')}','创建管理员',['600px','400px'],1)"><i class="Hui-iconfont"></i> 添加管理员</a> 
			</span> 
		</div>
		<php>
		
			$groupss = M('AuthGroup')->where('status = 1')->select();
			foreach($groupss as $g){
				$groups[$g['title']] = $g;
			}
			$map['role'] = array('like','%_ADMIN');
			$result = _get_list_data('/users/adminsadmin/index/',$_GET,$map,D('Users'));
		</php>
		<form class="mini-form">
		<table class="table table-border table-bordered table-hover table-bg">
			<thead>
				<tr>
					<th scope="col" colspan="9">管理员管理</th>
				</tr>
				<tr class="text-c">
					<th width="25"><input type="checkbox" value="" name=""></th>
					<th width="40">ID</th>
					<th width="200">用户名</th>
					<th width="300">角色</th>
					
					<th>更改时间</th>
					<th width="70">状态</th>
					<th width="70">操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="result['data']['list']" item="vo">
				<tr class="text-c">
					<td><input type="checkbox" value="{$vo.uid}" name="ids[]"></td>
					<td>{$vo.uid}</td>
					<td>{$vo.username}</td>
					<td>{$groups[$vo['role']]['desc']}({$groups[$vo['role']]['title']})</td>
					
					<td>{$vo.update_time}</td>
					<td>
            			<if condition="$vo['status'] eq 1"><span class="c-green">启用</span><else/><span class="c-red">禁用</span></if>
					</td>
					<td class="f-14">
						<if condition="$vo['status'] eq 0">
            			<a style="text-decoration:none" class="ml-5 ajax-get shuaxin" data-url="{:U('users/adminsadmin/changestatus','id='.$vo['uid'].'&status=1')}" href="javascript:;" title="启用"><i class="Hui-iconfont"></i></a>
            			<else/>
            			<a style="text-decoration:none" class="ml-5 ajax-get shuaxin" data-url="{:U('users/adminsadmin/changestatus','id='.$vo['uid'].'&status=0')}" href="javascript:;" title="禁用"><i class="Hui-iconfont"></i></a>
            			</if>
            			<a style="text-decoration:none" class="ml-5" onclick="open_iframe_dialog('{:U('users/adminsadmin/edit','id='.$vo['uid'])}','修改用户',['600px','400px'],1)" href="javascript:;" title="编辑"><i class="Hui-iconfont"></i></a>
            			<a style="text-decoration:none" class="ml-5 mini_del" data-url="{:U('users/adminsadmin/del','ids='.$vo['uid'])}" href="javascript:;" title="删除"><i class="Hui-iconfont"></i></a>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
		</form>
		{$result['pagetpl']}
	</div>
</block>

<block name="script">
<script>
$('#changeG').change(function(){
	var g = $(this).val();
	window.location.href="/users/adminsadmin/index/group/"+g+".html"; 
});
</script>
</block>